<%@page contentType="text/html;charset=UTF-8"%>
<%@include file="/common/commonTag.jsp"%>

<html>
	<head>
		<title>创建角色</title>
		<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
		<script type="text/javascript" src="${applicationScope.path}/js/jquery.js"></script>
		<link rel="stylesheet" type="text/css" href="${applicationScope.path}/style/styles.css">
		<link rel="stylesheet" type="text/css" href="${applicationScope.path}/style/main.css">
		<script type="text/javascript">
			function roleAddRes(type) {
				var roleName = $("#roleName").val() ;
				var roleDesc = $("#roleDesc").val() ;
				
				if(roleName != "" && roleDesc != "") {
					document.form.submit() ;
				} else {
					alert("请填写完整信息") ; 
				}
			}
		</script>
	</head>

	<body>
		<div class="context_head">
			后台管理 &gt;&gt;&nbsp;权限管理&gt;&gt;&nbsp;设置角色资源
		</div>
		<div class="context_text">
		<form name="form" action="${applicationScope.path}/privilegeRole!updateByIdRole.action" method="post">
			<table class="tables" width="80%">
				<tr>
					<th colspan="2" class="th1">
						创建角色
					</th>
				</tr>
				<tr>
					<td class="td3" align=right>
						角色名称：
					</td>
					<td class="td3">
						<input type="text" class="input1" id="roleName" name="roleVo.roleName" value="${queryByIdRole.roleName}"/>
					</td>
				</tr>
				
				<tr>
					<td class="td3" align=right>
						角色描述：
					</td>
					<td class="td3">
						<input type="text" class="input1" id="roleDesc" name="roleVo.roleDesc" value="${queryByIdRole.roleDesc}" />
					</td>
				</tr>
				<tr>
					<td class="td3" align=right>
						角色：
					</td>
					<td class="td3">
						<div style="float:left;width:350px;">
							<c:forEach var="resLists" items="${resList}" varStatus="v">
								<c:forEach var="res" items="${queryByIdRole.resource}">
									<c:if test="${resLists.resId==res.resId}">
										<c:set var="n" value="${resLists.resId}"></c:set>
										<div style="width:150px;float:left;">
											<input type="checkbox" value="${resLists.resId}" name="resId" checked="checked"/><b>${resLists.resName}</b>
										</div>
									</c:if>
								</c:forEach>
								<c:if test="${n != resLists.resId}">
									<div style="width:150px;float:left;">
										<input type="checkbox" value="${resLists.resId}" name="resId"/>${resLists.resName}
									</div>
								</c:if>
							</c:forEach>
						</div>
					</td>
				</tr>
				<tr>
					<td class="td3" colspan="2" align="center">
						<input type="hidden" name="roleVo.roleId" value="${queryByIdRole.roleId}" />
						<input type="submit" value="修改角色"/>
					</td>
				</tr>
			</table>
		</form>
		</div>
	</body>
</html>
